package com.zlf.the.data.access.object.pattern;

import com.zlf.the.data.access.object.pattern.dao.StudentDao;
import com.zlf.the.data.access.object.pattern.dao.StudentDaoImpl;
import com.zlf.the.data.access.object.pattern.entity.Student;

public class DaoPatternDemo {
		public static void main(String[] args) {
				StudentDao studentDao = new StudentDaoImpl();

				//print all students
				for (Student student : studentDao.getAllStudents()) {
						System.out.println("Student: [RollNo : " + student.getRollNo() + ", Name : " + student.getName() + " ]");
				}


				//update student
				Student student =studentDao.getAllStudents().get(0);
				student.setName("Michael");
				studentDao.updateStudent(student);

				//get the student
				studentDao.getStudent(0);
				System.out.println("Student: [RollNo : " + student.getRollNo() + ", Name : " + student.getName() + " ]");
		}
}
